<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="Content-type" content="text/html; charset=utf-8"/>
	<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no"/>
	<meta name="apple-mobile-web-app-capable" content="yes"/>
	<title>Transition Listener (pub/sub)</title>

	<script type="text/javascript" src="../deviceTheme.js" data-dojo-config="mblThemeFiles: ['base']"></script>
	<script type="text/javascript" src="../../../dojo/dojo.js" data-dojo-config="async: true, parseOnLoad: true"></script>

	<script type="text/javascript">
		require([
			"dojo/_base/connect",
			"dojox/mobile/parser",
			"dojox/mobile",
			"dojox/mobile/compat"
		], function(connect){
			var print = function(name, view, moveTo, dir, transition, context, method){
				console.log(name +
							": view=" + view +
							", moveTo=" + moveTo +
							", dir=" + dir +
							", transition=" + transition +
							", context=" + context +
							", method=" + method +
							", movedFrom=" + view.movedFrom);
			};

			connect.subscribe("/dojox/mobile/startView", function(view){
				console.log("startView: view="+view);
			});
			connect.subscribe("/dojox/mobile/beforeTransitionOut", function(view, moveTo, dir, transition, context, method){
				print("onBeforeTransitionOut", view, moveTo, dir, transition, context, method);
			});
			connect.subscribe("/dojox/mobile/beforeTransitionIn", function(view, moveTo, dir, transition, context, method){
				print("onBeforeTransitionIn", view, moveTo, dir, transition, context, method);
			});
			connect.subscribe("/dojox/mobile/afterTransitionOut", function(view, moveTo, dir, transition, context, method){
				print("afterTransitionOut", view, moveTo, dir, transition, context, method);
			});
			connect.subscribe("/dojox/mobile/afterTransitionIn", function(view, moveTo, dir, transition, context, method){
				print("afterTransitionIn", view, moveTo, dir, transition, context, method);
			});
		});
	</script>
</head>
<body style="visibility:hidden;">
	<div id="view1" data-dojo-type="dojox.mobile.View">
		<h1 data-dojo-type="dojox.mobile.Heading">Animations</h1>
		<h2 data-dojo-type="dojox.mobile.RoundRectCategory">Transition Effects</h2>
		<ul data-dojo-type="dojox.mobile.RoundRectList">
			<li data-dojo-type="dojox.mobile.ListItem" data-dojo-props='icon:"images/i-icon-1.png", moveTo:"view2", transition:"slide"'>
				Slide
			</li>
			<li data-dojo-type="dojox.mobile.ListItem" data-dojo-props='icon:"images/i-icon-2.png", moveTo:"view2", transition:"flip"'>
				Flip
			</li>
			<li data-dojo-type="dojox.mobile.ListItem" data-dojo-props='icon:"images/i-icon-3.png", moveTo:"view2", transition:"fade"'>
				Fade
			</li>
		</ul>
	</div>

	<div id="view2" data-dojo-type="dojox.mobile.View">
		<h1 data-dojo-type="dojox.mobile.Heading" data-dojo-props='back:"Home", moveTo:"view1"'>Search Result</h1>
		<div data-dojo-type="dojox.mobile.RoundRect" data-dojo-props='shadow:true'>
			Open the browser console to see transition event logs.
		</div>
	</div>
</body>
</html>
